home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
126-150
/
disk_129
/
patch
/
ver2.0
/
dfindone.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
731b
|
33 lines
#ifdef AMIGA
#include <dos.h>
#include <exec/memory.h>
#include <proto/exec.h>
#include <proto/dos.h>
/* Behaves almost like the Lattice dfind function, but dfindOne will not
* keep a lock.
*/
int dfindOne(info, name, attr)
struct FILEINFO *info;
char *name;
int attr;
{
BPTR lock;
struct FILEINFO *tmpInfo;
int retVal;
if(!(lock = Lock(name, ACCESS_READ)))
return(-1);
tmpInfo = (struct FILEINFO *) AllocMem(sizeof(*tmpInfo), MEMF_CLEAR);
if(retVal = Examine(lock, tmpInfo))
movmem((char *) tmpInfo, (char *) info, sizeof(*tmpInfo));
FreeMem((char *) tmpInfo, sizeof(*tmpInfo));
UnLock(lock);
if(retVal && (attr || info->fib_DirEntryType < 0))
return(0);
else
return(-1);
}
#endif